Repository navigation
fix(server): keep a failed service start out of the current state - #12199
vitalyiegorov wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrow service-install recovery fix that preserves the marker when activation fails, preventing a failed start from being reported as current and enabling a later retry. Successful installs still remove the marker, and targeted regression tests cover the failure and recovery flow. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughEvery install now writes a restart-pending marker before updating service state or the unit. Successful activation removes the marker. macOS tests verify that failed startup leaves the service non-current and that a later install retries activation and clears the marker. ChangesRestart-pending recovery
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant BootService.install
participant launchctl
participant BootService.status
BootService.install->>BootService.install: Write restart-pending marker
BootService.install->>launchctl: Bootstrap launch agent
launchctl-->>BootService.install: Startup failure
BootService.install->>BootService.status: Check service status
BootService.status-->>BootService.install: Report restart-pending and not current
BootService.install->>launchctl: Retry bootout, enable, and bootstrap
launchctl-->>BootService.install: Startup succeeds
BootService.install->>BootService.install: Remove restart-pending marker
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The failed-start retry now reports the service as not current and retries activation. No merge-blocking issue is evident after normal checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
cb1e33b to
de4a8db
Compare
e8751ed to
cb709a8
Compare
On launchd, `t3 service install` writes the plist and state before `launchctl bootstrap`. When bootstrap fails, nothing on disk records it, so the next `t3 service install` reports "already installed" while the previous launcher keeps running. Write the existing `.restart-pending` marker on every install, not only for `start: false`. A successful start still removes it; a failed one now leaves `status` reporting `restart-pending`, so the retry repairs the service. Fixes pingdotgg#12197 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cb709a8 to
0905300
Compare
Problem
Fixes #12197. On macOS 15 the first
t3 service installcan fail atlaunchctl bootstrap(#11995). By then the plist,service-state.jsonand runtime already name the new version, and nothing records the failed start. The retry printsT3 Code service is already installedand exits 0 while launchd keeps running the previous launcher, so every remote update stays blocked by the #11940 protocol gate.Change
BootService.installinapps/server/src/cloud/bootService.tsnow writes the existing.restart-pendingmarker on every install, not only forstart: false. It's one removed conditional. A successfulactivatestill removes the marker, and so dorestartand the launcher when it comes up on that version. A failed start therefore leavesstatusreportingrestart-pending, and the next install repairs the service instead of calling itself current.This complements #12005, which makes the stop and start actually replace the job. This PR only makes the retry honest.
Scope and approval
Julius triaged #12197 as a real bug, separate from #11995, and labelled it
accepted: #12197 (comment)Verification
launchctl bootstrapfails leaves the marker with the CLI version.statusthen reportsproblems: ["restart-pending"]withcurrent: false. A secondinstall(whatreconcileServicedoes for a status that isn't current) runs bootout, enable and bootstrap again and removes the marker.vp test run apps/server/src/cloud/bootService.test.ts: 39 passed, after rebasing on currentmain. Server typecheck, plus lint and format on the touched files.Implemented with Claude Fable 5.1 and Claude Opus 5 in T3 Code (Claude Code harness).
🤖 Generated with Claude Code